﻿/*
 *********************************************************************
 *    Management Extensions for Windows Windows Server AppFabric     *
 *********************************************************************
 *    Author    : Fatih Boy [fatih@enterprisecoding.com]             *
 *    Web site  : http://www.enterprisecoding.com                    *
 *********************************************************************
 *    License   : GNU Library General Public License (LGPL)          * 
 *********************************************************************
 */

using System;
using Com.Enterprisecoding.AppFabric.Extensions.Services;
using Microsoft.Web.Management.Server;

namespace Com.Enterprisecoding.AppFabric.Extensions {
    internal class AppFabricExtensionsService : ModuleService {
        [ModuleServiceMethod(PassThrough = true)]
        public object InvokeCacheAccountServiceMethod(string methodName, params object[] parameters) {
            return InvokeChildServiceMethod(typeof(CacheAccountService), methodName, parameters);
        }

        [ModuleServiceMethod(PassThrough = true)]
        public object InvokeCacheConfigBackupServiceMethod(string methodName, params object[] parameters) {
            return InvokeChildServiceMethod(typeof(CacheConfigBackupService), methodName, parameters);
        }

        private object InvokeChildServiceMethod(Type childServiceType, string methodName, object[] parameters) {
            var childServiceInstance = (ChildServiceBase)base.CreateChildService(childServiceType);

            return childServiceInstance.InvokeMethod(methodName, parameters);
        }
    }
}